/*
 * @Author: HeAo
 * @Date: 2021-10-20 15:30:00
 * @LastEditTime: 2021-10-20 15:34:25
 * @LastEditors: HeAo
 * @Description:
 * @FilePath: \vue-admin-template\src\store\modules\category.js
 * 别乱动！
 */
// 导入请求的工具包
import request from '@/utils/request'

export default {
  namespaced: true,
  state () {
    return {
      categories: []
    }
  },
  mutations: {
    SET_CATEGORIES (state, payload) {
      state.categories = payload
    }
  },
  actions: {
    async findAllCategories ({ commit }) {
      let res = await request.get('/category/findAll')
      // 提交突变
      commit('SET_CATEGORIES', res.data)
    }
  }
}
